<template>
    <view class="obj-money-button" :style="[buttonStyle]">
        <text>{{ buttonText }}</text>
    </view>
  </template>
  
  <script>
  export default {
    props: {
        buttonText: {
            type: String,
            default: '点击购买'
        },
        buttonWidth: {
            type: [Number, String],
            default: 171
        }
    },
    computed: {
        buttonStyle() {
            if (typeof this.buttonWidth === 'string' && this.buttonWidth.includes('%')) {
                return { width: this.buttonWidth }
            }
            return { width: `${this.buttonWidth}rpx` }
        }
    }
  }
  </script>
  
  <style lang="scss" scoped>
  .obj-money-button {
    height:64rpx;
    background: linear-gradient(148deg, #DB5656 0%, #C41F1F 100%);
    border-radius: 16px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    z-index: 10;
    
    text {
        z-index: 12;
        font-size: 28rpx;
        color: #F9DDB3;
        line-height: 32px;
        text-align: center;
        font-weight: 600;
    }
    
    &::before {
        content: '';
        position: absolute;
        top: -2px;
        left: -2px;
        right: -2px;
        bottom: -2px;
        background: linear-gradient(125deg, 
            rgba(224, 184, 121, 1),
            rgba(249, 221, 179, 1),
            rgba(234, 189, 156, 1)
        );
        border-radius: 18px;
        z-index: -1;
    }
    
    &::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: inherit;
        border-radius: 16px;
        z-index: 0;
    }
  }
  </style>